import request from '@/utils/request'

let orderApi = {
  // 新增自建订单
  addOrderBySelf(data) {
    return request({
      url: `/saleOrder/createSelf`,
      method: 'post',
      data
    })
  },
  // 拿id查询订单详情
  querySelfOrderById(id) {
    return request({
      url: `/saleOrder/${id}`,
      method: 'get'
    })
  },
  // 修改自建订单
  editOrderBySelf(data) {
    return request({
      url: `/saleOrder/editSelf`,
      method: 'post',
      data
    })
  },
  // 删除自建订单
  delOrderBySelf(data) {
    return request({
      url: `/saleOrder/delSelf`,
      method: 'post',
      data
    })
  },



  // 订单列表
  getList(query) {
    return request({
      url: '/account/order/list',
      method: 'get',
      params: query
    })
  },
  // 换绑信息
  getDetail(id) {
    return request({
      url: `/account/order/${id}`,
      method: 'get'
    })
  },
  // 换绑信息2
  getDetail2(id) {
    return request({
      url: `/account/order/account/${id}`,
      method: 'get'
    })
  },

  // 以下新增于2023-10-06
  // 号商提号确认下单
  addOrder(data) {
    return request({
      url: `/saleOrder/create`,
      method: 'post',
      data
    })
  },
  // 订单列表
  getListNew(query) {
    return request({
      url: '/saleOrder/list',
      method: 'get',
      params: query
    })
  },
  // 导出订单
  saleOrderexport(query) {
    return request({
      url: '/saleOrder/statistics/export',
      method: 'get',
      responseType: 'blob',
      params: query
    })
  },
  // 订单详情
  orderDetail(id) {
    return request({
      url: `/saleOrder/${id}`,
      method: 'get'
    })
  },
  // 立即支付 /saleOrder/payment  /pay/record/paymentTwo
  payNow(data) {
    return request({
      url: `/saleOrder/payment`,
      method: 'post',
      data
    })
  },
  // 轮询订单支付状态
  orderPayStatusInterval(query) {
    return request({
      url: `/saleOrder/orderStatus`,
      method: 'get',
      params: query
    })
  },
  // 支付后主动查询订单
  orderPayStatusHandle(data) {
    return request({
      url: `/saleOrder/queryOrder`,
      method: 'post',
      data
    })
  },
  // 取消订单
  cancelOrder(data) {
    return request({
      url: `/saleOrder/cancelOrder`,
      method: 'post',
      data
    })
  },
  // 修改订单价格
  editOrderPrice(data) {
    return request({
      url: `/saleOrder/updateAmount`,
      method: 'post',
      data
    })
  },
  // 完成订单
  finishOrder(data) {
    return request({
      url: `/saleOrder/finishOrder`,
      method: 'post',
      data
    })
  },
  // 一键拉群
  pullGroup(data) {
    return request({
      url: `/saleOrder/pullGroup`,
      method: 'post',
      data
    })
  },
  // 解散群组
  cancelGroup(data) {
    return request({
      url: `/saleOrder/cancelGroup`,
      method: 'post',
      data
    })
  },
  // huifu群组
  recoveryGroup(data) {
    return request({
      url: `/saleOrder/recoveryGroup`,
      method: 'post',
      data
    })
  },
  // 查询订单关联的群组
  getToGroup(data) {
    return request({
      url: `/saleOrder/getToGroup`,
      method: 'post',
      data
    })
  },
  // 转为交易中
  changeOrderStatus(data) {
    return request({
      url: `/saleOrder/changeOrderStatus`,
      method: 'post',
      data
    })
  },
  // 修改支付状态
  editPayStatus(data) {
    return request({
      url: `/saleOrder/changePayStatus`,
      method: 'post',
      data
    })
  },
  // 卖家发货
  saleOrderProfile(data) {
    return request({
      url: `/saleOrderProfile`,
      method: 'post',
      data
    })
  },
  // 查看发货资料
  getSaleOrderProfile(saleOrderId) {
    return request({
      url: `/saleOrderProfile/bySaleOrderId/${saleOrderId}`,
      method: 'get'
    })
  },
  // 编辑发货信息
  editSaleOrderProfile(data) {
    return request({
      url: `/saleOrderProfile`,
      method: 'put',
      data
    })
  },
  // 查询待结算的买家
  settlementBuyer() {
    return request({
      url: `/saleOrder/settlement/buyer`,
      method: 'get'
    })
  },
  // 查询待结算的卖家
  settlementSeller() {
    return request({
      url: `/saleOrder/settlement/seller`,
      method: 'get'
    })
  },
  // 查询待结算的订单
  settlementOrderList(params) {
    return request({
      url: `/saleOrder/settlement/list`,
      method: 'get',
      params
    })
  },
  // 订单结算
  financialStatementSaleOrder(data) {
    return request({
      url: `/financialStatement/saleOrder`,
      method: 'post',
      data
    })
  },
  // 订单统计列表
  saleOrderStatisticsList(params) {
    return request({
      url: `/saleOrder/statistics/list`,
      method: 'get',
      params
    })
  },
  // 订单信息修改
  changeOrderInfo(data) {
    return request({
      url: `/saleOrder/changeOrderInfo`,
      method: 'post',
      data
    })
  },
  // 导出待收款的订单
  exportSettlementOrderListBuyer(params) {
    return request({
      url: `/saleOrder/settlement/buy/export`,
      method: 'get',
      params
    })
  },
  // 导出待结算的订单
  exportSettlementOrderListSeller(params) {
    return request({
      url: `/saleOrder/settlement/sell/export`,
      method: 'get',
      params
    })
  },
  // 取消订单 卖家退款
  cancelOrderRepayment(data) {
    return request({
      url: `/financialStatement/seller/repayment`,
      method: 'post',
      data
    })
  },

  // 采购订单  订单列表
  caigoudingdanList(params) {
    return request({
      url: `/saleOrder/buyList`,
      method: 'get',
      params
    })
  },

  // 采购订单  拉群
  pullGroupB2B(data) {
    return request({
      url: `/saleOrder/pullGroupB2B`,
      method: 'post',
      data
    })
  },
  // 销售订单  汇付订单 取消订单后 查询退款状态
  queryRefundInfo(data) {
    return request({
      url: `/saleOrder/queryRefundInfo`,
      method: 'post',
      data
    })
  },


  // 采购订单 填报销售信息
  // 填报
  saleOrderCaigouAdd(data) {
    return request({
      url: `/saleOrderCaigou`,
      method: 'post',
      data
    })
  },
  // 编辑
  saleOrderCaigouEdit(data) {
    return request({
      url: `/saleOrderCaigou`,
      method: 'put',
      data
    })
  },
  // 删除
  saleOrderCaigouDel(id) {
    return request({
      url: `/saleOrderCaigou/${id}`,
      method: 'delete'
    })
  },
  // id查询
  saleOrderCaigouQueryByid(id) {
    return request({
      url: `/saleOrderCaigou/${id}`,
      method: 'get'
    })
  },


}

export default orderApi

